package com.cea.papyrus.diagram.activity.figure;

import org.eclipse.draw2d.FreeformLayer;
import org.eclipse.draw2d.FreeformLayout;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.ScrollPane;
import org.eclipse.draw2d.StackLayout;
import org.eclipse.swt.graphics.Color;

import com.cea.papyrus.core.figures.RoundedRectangleNodeFigure;


public class OpaqueActionBodyFigure extends com.cea.papyrus.core.figures.RoundedStickyNoteFigure{

	
	/**
	 */
	protected ActionContentFigure contentFigure;
	/**
	 * Creates a new OpaqueAction figure with the given margin.
	 * 
	 * @param borderSize the size of the border
	 */
	public OpaqueActionBodyFigure(int borderSize) {
		super(borderSize);
		contentFigure = new ActionContentFigure();
		add(contentFigure);
	}
	
	/**
	 * Creates a new OpaqueActionBody figure.
	 */
	public OpaqueActionBodyFigure() {
		super();
		contentFigure = new ActionContentFigure();
		add(contentFigure);
	}
	
	/**
	 * Set the body of the OpaqueAction in the figure.
	 * 
	 * @param comment the body of the OpaqueAction
	 */
	public void setBody(String body) {
		super.setText(body);
	}
	
	/**
	 * 
	 * 
	 * @param borderColor 
	 */
	@Override
	public void setBorderColor(Color borderColor) {
		// redefinition not to see a border around the OpaqueActionBody
		this.borderColor = borderColor;
	}

	/**
	 * 
	 * this is the zone to add an element into Opaque action
	 * @return the content pane
	 */
	public IFigure getContentPane() {
		return contentFigure.getContentPane();	
	}
	/**
	 * display the content of the activity
	 * 
	 */
	protected class ActionContentFigure extends RoundedRectangleNodeFigure  {
	
		/**
		 * 
		 */
		private IFigure pane;
		
		/**
		 * 
		 */
		protected ScrollPane scrollpane;
	
		/**
		 * 
		 */
		public ActionContentFigure() {
			// Set content layout
			setLayoutManager(new StackLayout());
	
			// Add pane for content
			pane = new FreeformLayer();
			pane.setLayoutManager(new FreeformLayout());
			add(pane);
		}
	
		/**
		 * 
		 * 
		 * @return 
		 */
		public IFigure getContentPane() {
			return pane;
		}
	
		/**
		 * Paint border.
		 * 
		 * @param graphics the graphics
		 */
		@Override
		public void paintBorder(Graphics graphics){	}
		
		/**
		 * Paint figure.
		 * 
		 * @param graphics the graphics
		 */
		@Override
		public void paintFigure(Graphics graphics){	}
	}
}
